package com.rslai.base.tool.servertest.model;

import com.rslai.base.tool.servertest.ServerTest;
import com.rslai.base.tool.servertest.ServerTest.Options;

import java.util.HashMap;
import java.util.Map;

public class Environment {
    public static final String OPERATION = "OPERATION";
    static final Map<String, Object> environments = new HashMap();

    public static void addEnvironment(String key, Object value) {
        environments.put(key, value);
    }

    public static Object getEnvironment(String key) {
        return environments.get(key);
    }

    public static void initEnvironment(Class<?> clazz) {
        ServerTest.Options options = (ServerTest.Options) clazz.getAnnotation(ServerTest.Options.class);
        addEnvironment("OPERATION", options.operation().valueOf());
    }

}
